# -*- coding: utf-8 -*-

#	This file is part of Kanji-Notification.

#	Kanji-Notification is free software: you can redistribute it 
#	and/or modify it under the terms of the GNU General Public License 
#	as published by the Free Software Foundation, either version 3 of 
#	the License, or	(at your option) any later version.
#
#	Kanji-Notification is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with Kanji-Notification. If not, see <http://www.gnu.org/licenses/>.

class Root:
	def __init__(self):
		self.fontName = "Ume Mincho"
		self.sleep = 60
		self.groups = {}
		self.kanji = []
	def add_kanji(self, kanji):
		self.kanji.append(kanji) 

class Group:
	def __init__(self, identifier):
		self.id = identifier
		self.kanji = set()
	"""Add a kanji to this group """
	def add_kanji(self, kanji):
		self.kanji.add(kanji)
		kanji.groups.append(self)
	def __str__(self):
		return self.id.__str__()

class Kanji:
	def __init__(self):
		self.uchar =  ""
		self.kun = []
		self.on = []
		self.examples = []
		self.groups = []
	def add_example(self, japanese, english):
		self.examples.append(Example(japanese,english))
	def add_example(self, example):
		self.example.append(example)
		
	def __str__(self):
		return unicode(self).encode('utf-8')
	def __unicode__(self):
		return self.uchar

class Example:
	def __init__(self, japanese, hiragana, english):
		self.japanese = japanese
		self.hiragana = hiragana
		self.english = english		
	def __str__(self):
		return unicode(self).encode('utf-8')
	def __unicode__(self):
		return "%s (%s) - %s" % (self.japanese,self.hiragana,self.english)
